#ifndef MYTIME_H
#define MYTIME_H

#include <Arduino.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Ticker.h>

// 定义一个结构存储时间
class CurrentTime {
private:
  int year;
  int month;
  int day;
  int weekday;
  int hour;
  int minute;
  int second;

public:
  int month_days[2][12] = { { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } };
  String chinese_weekday[7] = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
  String eng_weekday[7] = { "Sun", "Mon", "Thus", "Wed", "Thur", "Fri", "Sat" };

  void timeInitial(NTPClient timeClient);
  bool isLeapYear();
  void renewTime();
  void printTime();
  void printQuickTime();
  static void staticRenewTime(CurrentTime* instance);
  int get_hour();
  int get_minute();
  int get_second();
  int get_year();
  int get_month();
  int get_day();
  int get_weekday();
  String get_hour_str();
  String get_minute_str();
  String get_second_str();
  String get_calender_str();
};

String num2str(int digits);

#endif